<?php

namespace app\index\controller;

use app\common\controller\Base;
use think\Session;

class Login extends Base
{
    public function index()
    {

        return $this->fetch();

    }
    public function login()
    {

        $User      = model('User');
        $loginData = $this->param;
        if (!$this->checkCaptcha($loginData['captcha'])) {
            $this->error('验证码错误');
        }
        $resultData = $User->userLogin($loginData);
        if (!$resultData) {
            $this->error($User->getError());
        }
        Session::set('user', $resultData['userid']);
        $this->success('准备好了吗，准备传送~');
    }

}
